package cn.iocoder.yudao.framework.magic.config.function;


import org.springframework.stereotype.Component;
import org.ssssssss.magicapi.core.config.MagicFunction;
import org.ssssssss.script.annotation.Comment;
import org.ssssssss.script.annotation.Function;

import java.util.Map;

public class MapFunction implements MagicFunction {

    // JSONObject 删除空key
    @Function
    @Comment("JSONObject 删除空key")
    public static Map removeMapNullEntry(@Comment("需要处理的Map") Map map) {
        map.keySet().removeIf(
                key ->
                        key == null ||  map.get(key) == null
        );
        return map;
    }

}
